# Maintainer: boltgolt <boltgolt@gmail.com>
# Maintainer: Kelley McChesney <kelley@kelleymcchesney.us>
pkgname=pam-python
pkgver=1.0.8
pkgrel=1
pkgdesc="Python for PAM"
arch=('x86_64')
url="https://github.com/boltgolt/howdy"
license=('MIT')
depends=(
  'pam'
  'python2'
)
makedepends=(
  'python-sphinx'
  'cmake'
)
source=(
  "https://downloads.sourceforge.net/project/${pkgname}/pam-python-${pkgver}-1/${pkgname}-${pkgver}.tar.gz"
)
sha256sums=('fc69d7717db0509111500a81053487fa7684e1be3b7d0ae2b51970b6fdc918f6')

prepare() {
  # Preparing pam-python to be installed
  cd "$srcdir/$pkgname-$pkgver"
  sed -i'' 's|LIBDIR ?= /lib/security|LIBDIR ?= /usr/lib/security|g' src/Makefile
  sed -n '/^License/,/^--$/p' README.txt | grep -v -e '^License' -e '^-\+' > $srcdir/LICENSE
}

build() {
  # Building pam-python
  cd "$srcdir/$pkgname-$pkgver"
  PREFIX=/usr make
}

package() {
  # Installing pam-python
  cd "$srcdir/$pkgname-$pkgver"
  PREFIX=/usr make DESTDIR="$pkgdir/" install
  install -Dm644 "$srcdir/LICENSE" "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
